﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CL.Business.BLL;
using CL.Tools.Common;
using CL.View.Entity.Business;
using CL.View.Entity.Union;
using CL.Business.Entity;

namespace CL.UnionWeb.union
{
    public partial class Index : BasePage
    {

        protected udv_SettleDay yesterdayFanli = null; //昨日返利
        public List<NoticeEntity> Entitys = null;  //未读信息

        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "推广联盟-首页";

            var UserInfo = base.GetUnionInfo();
            var Daybll = new SettleDayBLL();
            var listFanli = Daybll.GetSettleDayBll(UserInfo.AccountID, DateTime.Now.ToString("yyyy-MM"));
            if(null != listFanli && 0 < listFanli.Count)
            {
                yesterdayFanli = listFanli.Find(x => x.Day == DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"));
            }

            //显示3条未读
            var noteBll = new NoticeBLL();
            int iCurrentListCount = 0;
            int UnReadCount = 0;
            Entitys = noteBll.QueryMyNotice(UserInfo.AccountID, 0, "", 1, 3, ref iCurrentListCount, ref UnReadCount);

            new RecordBLL().InsertEntity(new Business.Entity.RecordEntity()
            {
                AccountID = UserInfo.AccountID,
                RecordTime = DateTime.Now,
                RecordRemark = string.Format("访问首页 "),
                RecordType = 6
            });
        }
    }
}